#include <stdio.h>
#include <string.h>

union method
{
	int hundred;
	char five[10];
};

struct course
{
	char name[30];
	char mode;
	union method grade;
};

int main(void)
{
	struct course report[4];
	int i;
	
	strcpy(report[0].name, "C Language Programming");
	strcpy(report[1].name, "College Chinese");
	strcpy(report[2].name, "Advanced Mathematics");
	strcpy(report[3].name, "Introduction to Computers");
		
	for (i = 0; i < 4; i++)
	{
		printf("Input the mode(h/f) of course \"%s\": ", report[i].name);
		scanf("%c", &report[i].mode);
		printf("Examination Result: ");
		if ('h' == report[i].mode)
			scanf("%d", &report[i].grade.hundred);
		else
			scanf("%s", report[i].grade.five);
		getchar();
	}
	puts("\nname                          mode            grade");
	for (i = 0; i < 4; i++)
	{
		printf("%-30s%-16c", report[i].name, report[i].mode);
		if ('h' == report[i].mode)
			printf("%d\n", report[i].grade.hundred);
		else
			printf("%s\n", report[i].grade.five);
	}
	
	return 0;
}